package com.szp.lagou.dubbo.filerDemo.provider.service;

import com.szp.lagou.dubbo.filerDemo.filter.TransportIPFilter;
import org.apache.dubbo.rpc.RpcContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class GoodByeServiceImpl implements GoodByeService {
    Logger logger = LoggerFactory.getLogger(GoodByeServiceImpl.class);
    @Override
    public String sayGoodBye(String word) {
        RpcContext rpcContext = RpcContext.getContext();
        String clientIp = rpcContext.getAttachment(TransportIPFilter.CLIENT_IP_KEY);
        logger.info("从RpcContext中获取到客户端ip为:" + clientIp);
        System.out.println("从RpcContext中获取到客户端ip为:" + clientIp);
        return "Provider2 " + clientIp + " say goodbye " + word;
    }
}
